import 'package:flutter/material.dart';
import 'package:provide/provide.dart';
import '../provide/counter.dart';

class CategoryPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[Text('分类'),Content(),RaisedButton(onPressed:(){Provide.value<Counter>(context).increment();},child: Text('递增'),)],
      ),
    );
  }
}

class Content extends StatelessWidget {
  const Content({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    
    return Container(
      child: Provide<Counter>(
        builder: (context, child, counter) => Text('${counter.value}'),
      ),
    );
  }
}
